package com.inews.business.web;

import java.util.Map;

import javax.servlet.ServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.inews.base.mapper.JsonMapper;
import com.inews.base.utils.Servlets;
import com.inews.base.vo.ExtData;
import com.inews.business.service.RetireStaffHisService;
import com.inews.business.vo.RetireStaffHisVo;
import com.inews.business.vo.RetireStaffVo;

@Controller
@RequestMapping("/retireStaffHis")
public class RetireStaffHisController {
	
	@Autowired
	private RetireStaffHisService service;
	
	
	
	/**
	 * 分页查询退休人员历史.
	 *
	 * @param request the request
	 * @param pageNumber the page number
	 * @param sort the sort
	 * @param vo the vo
	 * @return the object
	 */
	@RequestMapping("findRetireStaffHisPage")
	@ResponseBody
	public Object findRetireStaffHisPage(ServletRequest request, @RequestParam(value = "page", defaultValue = "1") int pageNumber, String sort, RetireStaffVo vo){
		Pageable page = Servlets.buildPageRequest(pageNumber, sort);
		Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
		ExtData<RetireStaffHisVo> extData = service.findRetireStaffHisPage(searchParams, page, vo);
		String json = JsonMapper.nonEmptyMapper().toJson(extData);
		return json;
	}
	
	
	
	/**
	 * 报表导出.
	 *
	 * @return the model and view
	 */
	@RequestMapping("exportRetireStaffHisExcel")
	public String exportRetireStaffHisExcel(){
		return "retireStaffHisExcelView";
	}
	

}
